#include <iostream>
#include "include/minidbms.h"
#include "include/parse.h"
#include "include/DBMS.h"

using namespace std;

DBMS MyDB;//extern
//static int ccc=0;
int main()
{
    string name;
    cout<<"input the name of your input data document.\n";
    cin>>name;
    name= "inputdata/"+name+".txt";
    getchar();
    cout<<name<<endl;
    timer t;
    t.start();
    parse(name);
    t.finish();
    cout<<"all time: "<<t <<"\n";

    cout<<"write datas to files ? (y/n) \n";
    int cho=0;
    //cin>>cho;
    if(cho)
     MyDB.WriteToFile();

    cho =0;
    //cout<<"creat index ? (y/n) \n";
    //cin>>cho;
    if(cho)
        MyDB.CreateIndex();

/*
     ofstream out("output.out");
        MyDB.Print(out);
        out.close();
        */
}

void CallCreate(Create_Stmt query)
{
    MyDB.CreateTable(query);
}
void CallInsert(Insert_Stmt query)
{
    MyDB.Insert(query);
}

void CallSelect(Select_Stmt query)
{
    MyDB.Select(query);
}


